]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/network: Improve network toggle subtitles
authorGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 4 Feb 2023 15:25:01 +0000 (12:25 -0300)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Sat, 4 Feb 2023 21:10:22 +0000 (18:10 -0300)
If there is a single connection for a given NMToggle subclass,
use the connection name; otherwise, transform that into '%d
connected'. This is better than the current "Device (counter)"
template, e.g. "VPN (2)", which would give us a quick toggle
with:

   VPN
   VPN (2)

Change that to e.g.:

  VPN
  2 connected

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2619>

js/ui/status/network.js

index 781e298a46a2e10fb56e2b0ee9641f4197d4cf6d..2fa08cca95fd989d949d78c486d2c9f24ef296c9 100644 (file)
@@ -1363,13 +1363,13 @@ const NMToggle = GObject.registerClass({
 
     // transform function for property binding:
     // Ignore the provided label if there are multiple active
-    // items, and replace it with something like "VPN (2)"
+    // items, and replace it with something like "2 connected"
     _transformSubtitle(source) {
         const nActive = this.checked
             ? [...this._getActiveItems()].length
             : 0;
         if (nActive > 1)
-            return `${this._getDefaultName()} (${nActive})`;
+            return ngettext('%d connected', '%d connected', nActive).format(nActive);
         return source;
     }